#ifndef _PHYSICS_COMPONENT_H
#define _PHYSICS_COMPONENT_H

#include "..\Components\IComponent.h"
#include "..\Managers\PhysicsManager.h"
#include "..\EnumDefine.h"
#include "..\ScaleFactor.h"
#include "..\Generic\GameTime.h"

class ComponentVisitor;
class PhysicsComponent : public IComponent
	{
	public:
		virtual const std::string getType() { return "PhysicsComponent"; }
		virtual const std::string getFamilyType() { return "PhysicsComponent"; }
	
	public:
		PhysicsComponent(b2BodyType p_type, b2Vec2 p_setAsBox, b2Vec2 p_position, FixtureID p_fixtureID, int p_categoryCollisionID, int p_maskCollisionFilter = COLLF_DEFAULT, float p_density = 1.0f, float p_friction = 0.0f, float p_restitution = 0.0f, float p_angle = 0.0f );

		void update(const GameTime& p_gameTime);
		void init();

		const vn::Vector2 getPosition() { return vn::Vector2(m_body->GetWorldCenter().x / SCALEF, m_body->GetWorldCenter().y / SCALEF); }
		void setPosition(const vn::Vector2& p_position) { m_body->SetTransform(b2Vec2(p_position.x * SCALEF, p_position.y * SCALEF), 0.0f); }
		b2Body* getBody() { return m_body; }

		virtual ~PhysicsComponent();

		void acceptVisitor(ComponentVisitor* p_componentVisitor);

	private:
		b2Body* m_body;
		b2BodyDef m_bodyDef;
		b2Vec2 positions;
		CollisionFiltering m_collisionID;

		
	};

#endif //_PHYSICS_COMPONENT_H